//
//  ViewController.m
//  RACDemoOC
//
//  Created by SQ on 2020/1/19.
//  Copyright © 2020 shiqiao. All rights reserved.
//

#import "ViewController.h"

#import <ReactiveObjC/ReactiveObjC.h>

#import "ViewModel.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *userNameTextFiled;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextFiled;
@property (weak, nonatomic) IBOutlet UIButton *loginButton;

/** ViewModel */
@property (nonatomic, strong) ViewModel *viewModel;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _viewModel = [ViewModel viewModelWithUsernameSignal:self.userNameTextFiled.rac_textSignal passwordSignal:self.passwordTextFiled.rac_textSignal loginTapSignal:self.loginButton.rac_command];
    [self.userNameTextFiled.rac_textSignal subscribeNext:^(NSString * _Nullable x) {
        NSLog(@"x = %@",x);
    }];
}


@end
